package com.then.architecture;


import java.util.HashMap;
import java.util.Map;

import javax.inject.Singleton;

import dagger.android.HasActivityInjector;
import dagger.android.support.HasSupportFragmentInjector;

/**
 * Created by 42524 on 2018/1/15.
 */
@Singleton
public class InjectorMap {

    private Map<String,HasActivityInjector> activityInjectorMap;

    private Map<String,HasSupportFragmentInjector> fragmentInjectorMap;

    private static final InjectorMap ourInstance = new InjectorMap();


  public   static InjectorMap getInstance() {
        return ourInstance;
    }

    private InjectorMap() {
        activityInjectorMap=new HashMap<>();
        fragmentInjectorMap=new HashMap<>();
    }

    public void  putActivityInjector(String applicationId,HasActivityInjector value){
        activityInjectorMap.put(applicationId,value);
    }

    public void putFragmentInjector(String applicationId,HasSupportFragmentInjector value){
        fragmentInjectorMap.put(applicationId,value);
    }

    public HasActivityInjector getActivityInjector(String applicationId){
        return activityInjectorMap.get(applicationId);
    }

    public HasSupportFragmentInjector getSupportFragmentInjector(String applicationId){
        return fragmentInjectorMap.get(applicationId);
    }
}
